package com.ricky04.exception;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;

@Controller
public class ExceptionHandlerDemo {
    /**
     * 此种方式只能在当前controller中生效  其他里面不可以
     * @param e
     * @return
     */
    @ExceptionHandler(value = Exception.class)
    public String error(Exception e){

        return "error:"+ e.getMessage();
    }
}
